package com.yxb.config;

import com.yxb.config.aspect.LogAspect;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.*;
import org.springframework.core.env.Environment;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

/**
 * @author
 */


@Configuration
@ComponentScan(
        basePackages = {
                "com.yxb.service",
                "com.yxb.config.aspect"
        },
        includeFilters = {
                @ComponentScan.Filter(value = Component.class),
                @ComponentScan.Filter(value = Service.class),
        }
)
@Import(value = {com.yxb.config.MybatisConfig.class,com.yxb.config.JpushConfig.class})
@EnableAspectJAutoProxy
public class RootConfig {


    private static final Logger logger = LoggerFactory.getLogger(RootConfig.class);

    @Autowired
    private Environment env;

    @Bean
    public ThreadPoolTaskExecutor taskExecutor() {
        ThreadPoolTaskExecutor taskExecutor = new ThreadPoolTaskExecutor();
        taskExecutor.setCorePoolSize(4);
        taskExecutor.setMaxPoolSize(8);
        return taskExecutor;
    }
}
